package com.hzdesk.media.koreabatchmatvector.logic.view;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;

import com.hzdesk.media.koreabatchmatvector.R;
import com.hzdesk.media.koreabatchmatvector.base.MyClientApplication;
import com.hzdesk.media.koreabatchmatvector.bean.DcfBean;
import com.hzdesk.media.koreabatchmatvector.custom.FirstCanvas;
import com.hzdesk.media.koreabatchmatvector.custom.SecondCanvas;
import com.hzdesk.media.koreabatchmatvector.logic.contract.VideoPlayerContract;
import com.hzdesk.media.koreabatchmatvector.logic.persenter.VideoPlayerPersenter;
import com.mingle.widget.LoadingView;
import com.universalvideoview.UniversalMediaController;
import com.universalvideoview.UniversalVideoView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/6/22.
 * 杭州席媒科技有限公司  Developers  刘传华  16
 * 佛祖镇楼 bug辟易
 */

public class VideoPlayerActivity extends BaseActivity implements VideoPlayerContract.IVideoPlayerView {

    @BindView(R.id.activity_my_video_player)
    UniversalVideoView activityMyVideoPlayer;
    @BindView(R.id.activity_my_video_second_canvas)
    SecondCanvas activityMyVideoSecondCanvas;
    @BindView(R.id.activity_my_video_first_canvas)
    FirstCanvas activityMyVideoFirstCanvas;
    @BindView(R.id.activity_my_video_player_controller)
    UniversalMediaController activityMyVideoPlayerController;
    @BindView(R.id.activity_my_video_recyclerview)
    RecyclerView activityMyVideoRecyclerview;
    @BindView(R.id.activity_my_video_lin_set)
    LinearLayout activityMyVideoLinSet;
    @BindView(R.id.activity_my_video_player_loadview)
    LoadingView activityMyVideoPlayerLoadview;
    private VideoPlayerPersenter mVideoPlayerPersenter = new VideoPlayerPersenter(this);

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_video_player);
        ButterKnife.bind(this);
        mVideoPlayerPersenter.onStartDraw(this, MyClientApplication.getVideoFile(), activityMyVideoPlayer, activityMyVideoPlayerController);
        mVideoPlayerPersenter.initRecyclerView(activityMyVideoRecyclerview);
    }


    @Override
    public void show() {
        activityMyVideoFirstCanvas.setVisibility(View.VISIBLE);
        activityMyVideoSecondCanvas.setVisibility(View.VISIBLE);
    }

    @Override
    public void hide() {
        activityMyVideoFirstCanvas.setVisibility(View.GONE);
        activityMyVideoSecondCanvas.setVisibility(View.GONE);

    }

    @Override
    public void finshPager() {
        finish();
    }

    @Override
    public void onVideoPause() {

    }

    @Override
    public void onVideoStart() {

    }


    @Override
    public void onChangeProgress(long time) {
        //activityMyVideoFirstCanvas.changeProgress(time);
        activityMyVideoSecondCanvas.changeProgress(time);
    }

    @Override
    public void startDraw(DcfBean dcfBean, String name) {
        //activityMyVideoFirstCanvas.startDraw(dcfBean, name);
        activityMyVideoSecondCanvas.startDraw(dcfBean, name);
    }

    @Override
    public void showUserAnnotation(int num) {
        activityMyVideoSecondCanvas.showUserAnnotation(num);

    }

    @Override
    public void hideUserAnnotation(int num) {
        activityMyVideoSecondCanvas.hideUserAnnotation(num);

    }

    @Override
    public void showAllUserAnnotation() {
        activityMyVideoSecondCanvas.showAllUserAnnotation();

    }

    @Override
    public void hideAllUserAnnotation() {
        activityMyVideoSecondCanvas.hideAllUserAnnotation();

    }

    @Override
    public void showSetPage() {
        activityMyVideoLinSet.setVisibility(View.VISIBLE);

    }

    @Override
    public void hideSetPage() {
        activityMyVideoLinSet.setVisibility(View.GONE);

    }

    @Override
    public void onPrepared() {
        activityMyVideoPlayerLoadview.setVisibility(View.GONE);
    }

    @OnClick({R.id.activity_my_video_player, R.id.activity_my_video_second_canvas,
            R.id.activity_my_video_first_canvas, R.id.activity_my_video_player_controller})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.activity_my_video_player:
                break;
            case R.id.activity_my_video_second_canvas:
                break;
            case R.id.activity_my_video_first_canvas:
                break;
            case R.id.activity_my_video_player_controller:
                break;

        }
    }

}
